#include<stdio.h>
int A[100000],n;
int binarysearch(int key)
{
	int mid;
	int left=0,right =n;
	while(left<right)
	{
		mid=(left+right)/2;
		if(A[mid]=key)
		{
			return 1;
		}
		else if(A[mid]>key)
		{
			right=mid;
		}
		else left= mid+1;
	}
	return 0;
}
int main()
{
	int q,i,sum=0,k;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&A[i]);
	}
	scanf("%d",&q);
	{
		for(i=0;i<q;i++)
		{
			scanf("%d",&k);
			if(binarysearch(k))sum++;
		}
		printf("%d",sum);
	}
	return 0;
	
}
